package com.tasks.enums;

import org.apache.log4j.Logger;
import com.tasks.server.ServerException;

public class Priority extends Enum {
	
	static Logger logger = Logger.getLogger(Priority.class);
	
	public static final Priority NULL 	= new Priority(-1, "", "");
	public static final Priority Top 	= new Priority(0, "T", "Top");
	public static final Priority High 	= new Priority(1, "H", "High");
	public static final Priority Medium = new Priority(2, "M", "Medium");
	public static final Priority Low	= new Priority(3, "L", "Low");

	public static final Priority[] VALUES = new Priority[]
	{
		NULL,
		Top,
		High,
		Medium,
		Low
	};
	
	public Priority(int value, String code, String text) 
	{
		super(value, code, text);
	}
	
	public static Priority valueOf(int value)
	{
		for (int i = 0; i < VALUES.length; i++)
		{
			if (VALUES[i].intValue() == value)
			{
				return VALUES[i];
			}
		}

		new ServerException(Priority.class, "valueOf", "Enum value is undefined: " + value);
		return null;
	}
}
